package com.ruoyi.web.controller.gxs;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.gxs.domain.GxsActivityType;
import com.ruoyi.gxs.service.IGxsActivityTypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 活动级别Controller
 * 
 * @author 高晓松
 * @date 2023-12-27
 */
@RestController
@RequestMapping("/gxs/activityType")
public class GxsActivityTypeController extends BaseController
{
    @Autowired
    private IGxsActivityTypeService gxsActivityTypeService;

    /**
     * 查询活动级别列表
     */
//    @PreAuthorize("@ss.hasPermi('gxs:activityType:list')")
    @GetMapping("/list")
    public TableDataInfo list(GxsActivityType gxsActivityType)
    {
        startPage();
        List<GxsActivityType> list = gxsActivityTypeService.selectGxsActivityTypeList(gxsActivityType);
        return getDataTable(list);
    }

    /**
     * 导出活动级别列表
     */
//    @PreAuthorize("@ss.hasPermi('gxs:activityType:export')")
    @Log(title = "活动级别", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GxsActivityType gxsActivityType)
    {
        List<GxsActivityType> list = gxsActivityTypeService.selectGxsActivityTypeList(gxsActivityType);
        ExcelUtil<GxsActivityType> util = new ExcelUtil<GxsActivityType>(GxsActivityType.class);
        util.exportExcel(response, list, "活动级别数据");
    }

    /**
     * 获取活动级别详细信息
     */
//    @PreAuthorize("@ss.hasPermi('gxs:activityType:query')")
    @GetMapping(value = "/{gxsActivityTypeid}")
    public AjaxResult getInfo(@PathVariable("gxsActivityTypeid") Long gxsActivityTypeid)
    {
        return success(gxsActivityTypeService.selectGxsActivityTypeByGxsActivityTypeid(gxsActivityTypeid));
    }

    /**
     * 新增活动级别
     */
//    @PreAuthorize("@ss.hasPermi('gxs:activityType:add')")
    @Log(title = "活动级别", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GxsActivityType gxsActivityType)
    {
        return toAjax(gxsActivityTypeService.insertGxsActivityType(gxsActivityType));
    }

    /**
     * 修改活动级别
     */
//    @PreAuthorize("@ss.hasPermi('gxs:activityType:edit')")
    @Log(title = "活动级别", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GxsActivityType gxsActivityType)
    {
        return toAjax(gxsActivityTypeService.updateGxsActivityType(gxsActivityType));
    }

    /**
     * 删除活动级别
     */
//    @PreAuthorize("@ss.hasPermi('gxs:activityType:remove')")
    @Log(title = "活动级别", businessType = BusinessType.DELETE)
	@DeleteMapping("/{gxsActivityTypeids}")
    public AjaxResult remove(@PathVariable Long[] gxsActivityTypeids)
    {
        return toAjax(gxsActivityTypeService.deleteGxsActivityTypeByGxsActivityTypeids(gxsActivityTypeids));
    }
}
